<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>后盾人</title>
  </head>
  <body></body>
  <script>
    const protecteds = Symbol();
    class Common {
      constructor() {
        this[protecteds] = {};
        this[protecteds].host = 'https://houdunren.com';
      }
      set host(url) {
        if (!/^https?:/i.test(url)) {
          throw new Error('非常网址');
        }
        this[protecteds].host = url;
      }
      get host() {
        return this[protecteds].host;
      }
    }
    class User extends Common {
      constructor(name) {
        super();
        this[protecteds].name = name;
      }
      get name() {
        return this[protecteds].name;
      }
    }
    let hd = new User('后盾人');
    hd.host = 'https://www.hdcms.com';
    console.log(hd[Symbol()]);
    console.log(hd[protecteds].name);
    console.log(hd.name);
  </script>
</html>
